﻿Imports System.ComponentModel.DataAnnotations

Public Class PatientPrescription
    Public Property prescriptionID() As Short
    <Required()> _
    Public Overloads Property patientId() As Long
    <Required()> _
    Public Property medicineItemID() As Long

    Public Property medicineItem As String
    <Required()> _
    Public Property dosage() As Single
    Public Property frequency() As System.Nullable(Of Integer)
    Public Property frequencyName As String
    Public Property duaration() As Double
    Public Property periods() As String
#Region "NHibernate Composite Key Requirements"
    Public Overrides Function Equals(ByVal obj As Object) As Boolean
        If obj Is Nothing Then Return False
        Dim t = TryCast(obj, PatientPrescription)
        If t Is Nothing Then Return False
        If patientId = t.patientId AndAlso prescriptionID = t.prescriptionID Then
            Return True
        End If

        Return False
    End Function
    Public Overrides Function GetHashCode() As Integer
        Dim hash As Integer = 13
        hash += patientId.GetHashCode()
        hash += prescriptionID.GetHashCode()

        Return hash
    End Function
#End Region
End Class
